package com.ks.comment.controller;


import com.ks.comment.controller.dto.CommentListRequest;
import com.ks.comment.service.IZpzJournalService;
import com.ks.core.base._ControllerBase;
import com.ks.core.core.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 信息收藏日志 前端控制器
 * </p>
 *
 * @author kingdee123
 * @since 2020-12-18
 */
@RestController
@RequestMapping("/zpzJournal")
@Api(value = "信息收藏日志",description = "信息收藏日志")
public class ZpzJournalController extends _ControllerBase {

    @Autowired
    private IZpzJournalService zpzJournalService;

    @GetMapping("/queryJournalState")
    @ApiOperation(value = "获取会员用户的收藏状态", notes = "获取会员用户的收藏状态")
    public Object queryJournalState(@RequestParam int informationId, @RequestParam String type) {
        int i = zpzJournalService.queryJournalStatus(this.GetAuthorToken(), informationId, type);
        return Result.success(i);
    }


    @GetMapping("/addJournal")
    @ApiOperation(value = "会员添加收藏状态", notes = "会员添加收藏状态")
    public Object addJournal(@RequestParam int informationId, @RequestParam String type) {
        int i = zpzJournalService.addJournal(this.GetAuthorToken(), informationId, type);
        return Result.success(i);
    }

    @PostMapping("/getJournalList")
    @ApiOperation(value = "请求信息的收藏记录清单", notes = "请求信息的收藏记录清单")
    public Object addJournal(@RequestBody CommentListRequest request) {
        Map<String, Object> journalList = zpzJournalService.getJournalList(request.getInFormationId(), request.getType(), request.getPageNo(), request.getPageSize());
        return Result.success(journalList);
    }


}

